//
//  Music.m
//  MusicPlayer
//
//  Created by 千里马LZZ on 13-10-19.
//  Copyright (c) 2013年 Lizizheng. All rights reserved.
//

#import "Music.h"

@implementation Music
@synthesize name, type;

- (id)initWithName:(NSString *)_name andType:(NSString *)_type {
    if (self = [super init]) {
        self.name = _name;
        self.type = _type;
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder //将属性进行编码
{
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.type forKey:@"type"];
    [aCoder encodeBool:self.isCacheData forKey:@"isCacheData"];
    [aCoder encodeObject:self.urlPath forKey:@"urlPath"];
    [aCoder encodeObject:self.ID forKey:@"ID"];
    [aCoder encodeObject:self.AudioPath forKey:@"AudioPath"];
    [aCoder encodeObject:self.AudioStatus forKey:@"AudioStatus"];
    [aCoder encodeObject:self.Sentiment forKey:@"Sentiment"];
    [aCoder encodeObject:self.musicType forKey:@"musicType"];
    [aCoder encodeObject:self.Singer forKey:@"Singer"];
}

- (id)initWithCoder:(NSCoder *)aDecoder //将属性进行解码
{
    self = [super init];
    if (self) {
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.type = [aDecoder decodeObjectForKey:@"type"];
        self.isCacheData = [aDecoder decodeBoolForKey:@"isCacheData"];
        self.urlPath = [aDecoder decodeObjectForKey:@"urlPath"];
        self.ID = [aDecoder decodeObjectForKey:@"ID"];
        self.AudioPath = [aDecoder decodeObjectForKey:@"AudioPath"];
        self.AudioStatus = [aDecoder decodeObjectForKey:@"AudioStatus"];
        self.Sentiment = [aDecoder decodeObjectForKey:@"Sentiment"];
        self.musicType = [aDecoder decodeObjectForKey:@"musicType"];
        self.Singer = [aDecoder decodeObjectForKey:@"Singer"];
    }
    return self;
}

@end
